<template>
  <div class="login-container">
    <!-- <van-nav-bar
      style="background-color: #fff;"
      title="首页"
      left-text="x"
      right-text="退出"
      @click-right="$router.go(-1)"
      @click-left="$router.go(-1)"
    /> -->
    <header-card :myProp="myProp"></header-card>
    <div class="main-box">
      <div class="search-box">
        <img src="../assets/image/工资发放.png" alt="">
        <div class="btn">
          <van-button style="width: 70%; border-radius: 50px;" type="info" @click="toSalaryRecordSearchPage">工资发放记录查询</van-button>
        </div>
      </div>
      <div class="search-box" style="margin-top: 20px;">
        <img src="../assets/image/社保信息.png" alt="">
        <div class="btn">
          <van-button style="width: 70%; border-radius: 50px;" type="info" @click="toSocialSearchPage">社保信息查询</van-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import HeaderCard from '@/components/headerCard.vue'
// import { userData, myUserData } from '@/api/login'
export default {
  name: 'index',
  components: {
    'header-card': HeaderCard
  },
  data () {
    return {
      myProp: {
        username: '',
        idNum: '',
        isIndex: true
      }
    }
  },
  created () {
    // this.getUserInfo()
    this.myProp.username = this.$store.state.user.userName
    this.myProp.idNum = this.$store.state.user.idCard
  },
  methods: {
    // 前往工资发放记录查询页面
    toSalaryRecordSearchPage () {
      this.$router.push('/salaryRecordSearch')
    },
    // 前往社保查询
    toSocialSearchPage () {
      // this.$toast('功能建设中，敬请关注！')
      this.$router.push('/socialSearch')
    },
    // 前往个人中心页
    toPersonCenterPage () {
      this.$router.push('/personCenter')
    },
    // 前往登录页
    toLoginPage () {
      this.$router.push('/login')
    },
    // 获取当前页面域名
    getDomainName () {
      const url = window.location.href
      const indexEnd = url.indexOf('/', 9)
      this.$store.commit('setBaseUrl', url.slice(0, indexEnd))
    }
  }
}
</script>

<style scoped lang="less">
.login-container{
  font-size: 14px;
  min-height: 100vh;
  background-color: #f8f8f8;
  .main-box{
    position: relative;
    background-color: #f8f8f8;
    .search-box{
      height: 210px;
      width: 88%;
      margin: 0 3.5%;
      border-radius: 5px;
      position: relative;
      top: -60px;
      padding: 10px;
      text-align: center;
      background-color: #fff;
      img{
        width: 70%;
      }
      .btn{
        margin-top: 15px;
      }
    }
  }
}
</style>
